import { StyleSheet, View } from 'react-native';
import React from 'react';
import WebView from 'react-native-webview';
import { useRoute } from '@react-navigation/native';
import { useTranslation } from 'react-i18next';
import { appStore, userStore } from '~/store';
import { NavBarHeader } from '~/components';
import { baseURL } from '!/app.json';

export default function MyCourseDetailes() {
    const { t } = useTranslation();
    // 显示小包的疗程详情
    const router = useRoute<any>();
    const { device_sn, user_course_id, pupillus_mobile, type = 1 } = router.params || {};
    const url = `${baseURL}wxdata/courseDetail.html?armariumScienceSession=${userStore.me.token}&device_sn=${device_sn}&user_course_id=${user_course_id}&type=${type}&local=${appStore.app.language}`;
    return (
        <View style={styles.container}>
            <NavBarHeader title={t('MyCourseDetailes.title')} />
            <WebView source={{ uri: url }} textZoom={100} />
        </View>
    );
}

const styles = StyleSheet.create({
    container: {
        flex: 1,
    },
});
